home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The X-Philes (2nd Revision)
/
The X-Philes Number 1 (1995).iso
/
xphiles
/
hp48hor1
/
getkey.doc
< prev
next >
Wrap
Text File
|
1995-03-31
|
2KB
|
46 lines
GETKEY, by Joseph K. Horn
Here's a useful utility for fetching a single key definition, very
much like FETCH KEY on the HP-75 and HP-71.
The following RPL routine works instantly. Shifted, alpha, and
shifted alpha keys all work. The only key it won't fetch is ATTN,
which is used to exit the program if desired.
INSTRUCTIONS: Run it, then press any key. Its definition will be
recalled to the stack, with its keycode above it. Since it gives no
indication that it's running, do not include it in programs; only
use it from the keyboard.
It is most useful when assigned to a key; fetching a key definition
only takes two keystrokes then. I keep it assigned to the Equation
Writer key (which won't be useful until Version HP48-F).
RPL listing of GETKEY:
02D9D Begin program object
2A2B4 0; for 0 WAIT construct
1A738 Internal WAIT; pause until key press; return rc.p keycode
03188 Internal DUP; float keycode until the end
41CA2 Convert rc.p keycode into <key> <plane> system keycodes
41F3F Recall contents of UserKeys var to the stack
03295 Internal ROT --> { UserKeys } <key>
056B6 Internal GET --> { all 6 definitions on that key } True
03244 Internal DROP; lose the True
63A6F Is the list empty? If so, push a True
6191F If True, DROP2, do next, and end; else skip next
6577B "Undefined"; the entire key is undefined; say so & stop
03223 Internal SWAP --> { the key's 6 definitions } <plane>
056B6 Internal GET --> either the definition or { }, and True
03244 Internal DROP; lose the True
63A6F Is the list empty? If so, push a True
618F7 If True, DROP, do next, and end; else skip next
6577B "Undefined"; that key is undefined; say so & stop
0312B End program; exit with keycode floating above definition.
Bytes: 47.5; Checksum: # E49Dh.
Thanks to Rick Grevelle and Derek Nickel who made this possible.
-- Joseph K. Horn -- Peripheral Vision, Ltd. --